package com.heima.leetcode.datastructure.binarytree;

/**
 * @author 勾新杰
 * @version 1.0
 * @date 2024/9/8 10:53
 */
public class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;

    public TreeNode(int val) {
        this.val = val;
    }

    public TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        LevelOrderTraversal.levelOrder(this,a->builder.append(a).append(" "));
        return builder.toString();
    }
}
